package pers.buyusan;

import org.apache.dubbo.rpc.RpcContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import pers.buyusan.service.HelloService;

import java.io.IOException;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;

public class DubboConsumer {

    public static void main(String[] args) throws IOException,
            InterruptedException, ExecutionException {
        ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("dubbo-*.xml");
        context.start();

        HelloService service =
                context.getBean(HelloService.class);

        String byebye = service.sayHello("byebye", 200);
        System.out.println(byebye);
        Future<Object> future = RpcContext.getContext().getFuture();
        System.out.println(future.get());


    }

}
